const app = getApp()
Page({
    data: { is_expand: false },
    onLoad(options) {
        this.setData(options)
    },

    onShow() {
        wx.showLoading({
            title: '获取中...',
        })
        app.http.get("member/express", {
            data: { id: this.data.id },
            showMsg: true
        }).then(result => {
            this.setData({
                loading: false,
            })
            result.data.express.Traces.forEach((o, index) => {
                o.expand = index < 3
            })
            this.setData(result.data)
            wx.hideLoading()
        })
    },



    expand() {
        this.setData({
            is_expand: !this.data.is_expand,
        })
        for (var i = 0; i < this.data.express.Traces.length; i++) {
            i >= 3 && this.setData({
                [`express.Traces[${i}].expand`]: this.data.is_expand
            })
        }
    }
})